package array

import (
	"math/rand"
	"time"
)

type Solution struct {
	nums   []int
	length int
}

func Constructor384(nums []int) Solution {
	return Solution{
		nums:   nums,
		length: len(nums),
	}
}

func (this *Solution) Reset() []int {
	return this.nums
}

func (this *Solution) Shuffle() []int {
	rand.Seed(time.Now().UnixNano())

	temp := make([]int, len(this.nums))
	copy(temp, this.nums)

	for i := range temp {
		j := rand.Intn(this.length) // [0,n)
		temp[i], temp[j] = temp[j], temp[i]
	}

	return temp
}
